#include "RoomEditor.h"

RoomEditor::RoomEditor( QWidget* parent )
    : QWidget( parent )
{
	// Layout
	QGridLayout* layout = new QGridLayout();
	setLayout( layout );

	// Name
	QFormLayout* nameLayout = new QFormLayout();
	layout->addItem( nameLayout, 0, 0 );
	mNameLabel = new QLabel( this );
	nameLayout->addRow( new QLabel( "Name:", this ), mNameLabel );

	// id
	QFormLayout* idLayout = new QFormLayout();
	layout->addItem( idLayout, 0, 1 );
	mIdLabel = new QLabel( this );
	idLayout->addRow( new QLabel( "\tid:", this ), mIdLabel );
}

RoomEditor::~RoomEditor()
{
}

void
RoomEditor::editRoom( Room* room )
{
	mRoom = room;
	if( mRoom != NULL )
	{
		mNameLabel->setText( room->name() );
		mIdLabel->setText( QString::number( room->id() ) );
	}
}